package com.lingdian.busapp;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ListView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lingdian.busapp.adapter.BusListAdapter;

public class BusListViewActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_bus_list_view);
		ListView busListView = (ListView) findViewById(R.id.BusListView);
		String result = getIntent().getStringExtra("result");
		JSONObject data = JSONObject.parseObject(result);
		try {
			BusListAdapter adapter = new BusListAdapter(data, this, R.layout.item_bus_list_view);
			busListView.setAdapter(adapter);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.bus_list_view, menu);
		return true;
	}

}
